import { Tag } from 'ant-design-vue';
import type { TableColumn } from '@/components/core/dynamic-table';

export type TableListItem = API.ActionTempResultItem;
export type TableColumnItem = TableColumn<TableListItem>;

export const baseColumns: TableColumnItem[] = [
  {
    title: '模版编号',
    dataIndex: 'ACTION_TEMP_NO',
    align: 'center',
    hideInSearch: true,
  },
  {
    title: '模版名称',
    dataIndex: 'ACTION_TEMP_NAME',
    align: 'center',
  },
  {
    title: '模版类型',
    dataIndex: 'ACTION_TEMP_TYPE',
    align: 'center',
    hideInSearch: true,
    customRender: ({ record }) => (
      <Tag color={record.ACTION_TEMP_TYPE == 0 ? 'green' : record.ACTION_TEMP_TYPE == 1 ? 'yellow' : 'blue'}>
        {record.ACTION_TEMP_TYPE == 0 ? '自定义' : record.ACTION_TEMP_TYPE == 1 ? '系统内置' : '用户新增'}
      </Tag>
    ),
    formItemProps: {
      component: 'Select',
      componentProps: () => ({
        options: [
          {
            label: '自定义',
            value: 0,
          },
          {
            label: '系统内置',
            value: 1,
          },
          {
            label: '用户新增',
            value: 2,
          },
        ],
      }),
    },
  },
  {
    title: '模版状态',
    dataIndex: 'ACTION_TEMP_STATE',
    align: 'center',
    customRender: ({ record }) => (
        <Tag color={record.ACTION_TEMP_STATE == 0 ? 'yellow' : record.ACTION_TEMP_STATE == 1 ? 'green' : 'red'}>
        {record.ACTION_TEMP_STATE == 0 ? '不可用' : record.ACTION_TEMP_STATE == 1 ? '可用' : '已删除'}
      </Tag>
    ),
    formItemProps: {
      component: 'Select',
      componentProps: () => ({
        options: [
          {
            label: '不可用',
            value: 0,
          },
          {
            label: '可用',
            value: 1,
          },
          {
            label: '已删除',
            value: 2,
          }
        ],
      }),
    },
  },
  {
    title: '备注',
    dataIndex: 'ACTION_TEMP_REMARKS',
    align: 'center',
    hideInSearch: true,
  }
];
